package com.baiyun.controller.user;


import com.baiyun.Result.Result;
import com.baiyun.entity.Inventory;
import com.baiyun.service.InventoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/user/inventorys")
@RequiredArgsConstructor
@Api(tags = "客户端端——库存管理")
public class UserInventoryController {

    private final InventoryService inventoryService;
    /**
     * 根据tid查询库存
     * @param tid
     * @return
     */
    @GetMapping("/{tid}")
    @ApiOperation("根据tid查询库存")
    public Result<Inventory> selectInventoryByTid(@ApiParam("茶id")@PathVariable("tid") Integer tid){
        return Result.success(inventoryService.selectInventoryByTid(tid));
    }
}
